package com.sgb.kjwl.view.ui.adapter;

import android.content.Context;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.supplier3.DictEntity3;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class MultiDictAdapter4 extends BaseRecycleAdapter<DictEntity3> {

    public MultiDictAdapter4(Context context, List<DictEntity3> datas) {
        super(context, R.layout.item_multi_dict4, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final DictEntity3 entity) {
        holder.setBinding(BR.viewModel, entity);
    }

    public void checkDefultId(List<String> checkedId) {
        if (checkedId == null) {
            return;
        }
        List<DictEntity3> dictEntity3List = getDatas();
        if (dictEntity3List == null || dictEntity3List.size() == 0) {
            return;
        }
        for (int i = 0; i < dictEntity3List.size(); i++) {
            for (String s : checkedId) {
                if (dictEntity3List.get(i).getId().equals(s)) {
                    getCheckList().put(i, true);
                    getCheckDatas().add(dictEntity3List.get(i));
                }
            }
        }
        notifyDataSetChanged();
    }
}
